package com.nuaa.ange.service.serviceImpl;

import com.nuaa.ange.entity.Article;
import com.nuaa.ange.service.ElasticSearchService;
import com.nuaa.ange.utils.ElasticSearchUtil;

import java.io.IOException;

/**
 * @author 玦离
 * @description
 * @date 2023/1/1 20:10
 */

public class ElasticSearchServiceImpl implements ElasticSearchService {

    @Override
    public void createDoc(Article article) {
        ElasticSearchUtil.createDocument(article);
    }

    @Override
    public void deleteDoc(int articleId) {
        try {
            ElasticSearchUtil.deleteDocument(articleId);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void updateDoc(Article article) {
        try {
            ElasticSearchUtil.updateDocument(article);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
